/*
 * @Descripttion: 地球-浙江
 * @Author: sujunling
 * @Date: 2025-10-30 23:20:26
 */
package generatetiff
package main

import (
	"fmt"
	"image"
	"image/color"

	"github.com/chai2010/tiff"
)

func main() {
	// Create a simple 100x100 grayscale image
	img := image.NewGray(image.Rect(0, 0, 100, 100))

	// Fill with a gradient pattern
	for y := 0; y < 100; y++ {
		for x := 0; x < 100; x++ {
			// Create a simple elevation pattern
			val := uint8((x + y) / 2) // Simple gradient
			img.SetGray(x, y, color.Gray{val})
		}
	}

	// Save as TIFF
	file, err := tiff.Create("test_dem.tiff")
	if err != nil {
		fmt.Printf("Failed to create TIFF file: %v\n", err)
		return
	}
	defer file.Close()

	err = tiff.Encode(file, img, nil)
	if err != nil {
		fmt.Printf("Failed to encode TIFF image: %v\n", err)
		return
	}

	fmt.Println("Test TIFF file created: test_dem.tiff")
}